package com.cilico.single.components;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import android.widget.RatingBar.OnRatingBarChangeListener;

import com.cilico.single.R;
import com.cilico.single.view.FormLayout;

public class wRatingBar extends LinearLayout implements  Component{
	Activity bv_;
	String name_;
	String value_;
	RatingBar ratingBar_;
	public int rate;
	private int width_ = 150;
	private int height_ =150;
	
	public wRatingBar(Context context, String name, String value) {
		super(context);
		bv_ = (Activity) context;
		name_ = name;
		value_ = value;
	}


	public void initView() {
        View options = (View) bv_.getLayoutInflater().inflate(R.layout.ratingbar_layout, null);
        ratingBar_ = (RatingBar)options.findViewById(R.id.ratingBar);
        ratingBar_.setOnRatingBarChangeListener(new OnRatingBarChangeListenerImp());
        addView(ratingBar_);
	}

    private class OnRatingBarChangeListenerImp implements OnRatingBarChangeListener {

		@Override
		public void onRatingChanged(RatingBar ratingBar, float arg1, boolean arg2) {
			int rate = ratingBar.getProgress();
			System.out.println("rate result is :" + rate);
		}
    }
	
	@Override
	public String getContentText() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setContentText(String text) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void shrinkWidth() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void cleanText() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mould() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setCmpWidth(int width) {
		// TODO Auto-generated method stub

	}

	@Override
	public int getCmpWidth() {
		// TODO Auto-generated method stub
		return width_;
	}

	@Override
	public void setCmpHeidht(int height) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public int getCmpHeight() {
		// TODO Auto-generated method stub
		return height_;
	}

	@Override
	public void setCssStyle(CssStyle style) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public View getCmpView() {
		// TODO Auto-generated method stub
		return this;
	}

	@Override
	public void setInTable(boolean inTable) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean isInTable() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public CssStyle getCssStyle() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void releaseResource(View view) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setForm(FormLayout formLayout) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public FormLayout getForm() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setEncrypt(String encrypt) {
		// TODO Auto-generated method stub
		
	}

}
